<?php
	/* Description: This file is used to add sub sub category. */
	#########IncludeFiles####################################################################################
	include_once '../inc/config.php';
	include_once("../inc/bootstrape.php");
	require_once _SITE_PATH_.'classes/Master/Master.php';
	require_once _SITE_PATH_.'classes/Product/Product.php';
	require_once _SITE_PATH_.'classes/Content/Content.php';
	require_once _SITE_PATH_.'classes/CommonUtility/CommonUtility.php';

	if( $_POST['submit']=='Submit'){   
		$parms['slug'] = str_replace(' ','-',$_POST['slug']);
		$parms['title'] = $_POST['title'];
		$parms['description'] = $_POST['description'];
		$parms['meta_title'] = $_POST['meta_title'];
		$parms['meta_description'] = $_POST['meta_description'];
		$parms['meta_keywords'] = $_POST['meta_keywords'];
		$parms['added'] = date("Y-m-d h:i:s");
		$parms['modified'] = date("Y-m-d h:i:s");

		// upload and create thumb of the image //
		if( !empty( $_FILES['page_image'] ) ){
			$filename  = 'page_image';     //  this is name of the control you are using in html form
			$module='page_content';
			$uploadedfile = CommonUtility::uploadNcreateThumb($filename, $module, true, 100, true);
			if( $uploadedfile!= -1 )    {
				$parms['image'] = $uploadedfile;//$_POST['package_image'];
			}
		}
		
		if( CommonUtility::insertData($parms, 'page_content')) {        
			header("Location: page_mng.php?msg=1784");            
			exit;
		}
		$err = 1785;    
	}
	
	$editor = CommonUtility::includeEditor();
	
	$errMsg = $err;
	$_tplName = 'content/page_add.tpl';
	$_title = 'Add News';

	require_once _ADMIN_TPL_MAIN_;
?>